package com.slz3.business.module.configManagement.conZoneManage.steward;

import com.slz3.business.frame.response.RR;
import com.slz3.business.frame.response.ResInfo;
import com.slz3.business.module.configManagement.conZoneManage.domain.ConZoneManage;
import com.slz3.business.module.configManagement.conZoneManage.domain.ConZoneManageCondition;
import org.springframework.stereotype.Controller;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;

import javax.annotation.Resource;

@Controller
public class ConZoneManageResController {

    @Resource
    private ConZoneManageResAtomic conZoneManageResAtomic;

    public Mono<ServerResponse> add(ServerRequest req, ConZoneManage conZoneManage) {
        if (ConZoneManageResUnsafeValid.add(req, conZoneManage)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return conZoneManageResAtomic.add_$ConZoneManageUpdateLock(req, conZoneManage);
        }
    }

    public Mono<ServerResponse> delete(ServerRequest req, ConZoneManageCondition conZoneManageCondition) {
        if (ConZoneManageResUnsafeValid.delete(req, conZoneManageCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return conZoneManageResAtomic.delete_$ConZoneManageUpdateLock(req, conZoneManageCondition);
        }
    }

    public Mono<ServerResponse> modify(ServerRequest req, ConZoneManage conZoneManage) {
        if (ConZoneManageResUnsafeValid.modify(req, conZoneManage)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return conZoneManageResAtomic.modify_$ConZoneManageUpdateLock(req, conZoneManage);
        }
    }

    public Mono<ServerResponse> list(ServerRequest req) {
        if (ConZoneManageResUnsafeValid.list(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return ConZoneManageResExecutor.list(req);
        }
    }

    public Mono<ServerResponse> info(ServerRequest req) {
//        return conZoneManageResAtomic.info_$ConZoneManageUpdateLock(req);
        if (ConZoneManageResUnsafeValid.info(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return conZoneManageResAtomic.info_$ConZoneManageUpdateLock(req);
        }
    }

    public Mono<ServerResponse> choice(ServerRequest req) {
        if (ConZoneManageResUnsafeValid.choice(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return ConZoneManageResExecutor.choice(req);
        }
    }

    public Mono<ServerResponse> auditSubmit(ServerRequest req, ConZoneManageCondition conZoneManageCondition) {
        //
        if (ConZoneManageResUnsafeValid.auditSubmit(req, conZoneManageCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return conZoneManageResAtomic.auditSubmit_$ConZoneManageUpdateLock(req, conZoneManageCondition);
        }
    }

    public Mono<ServerResponse> audit(ServerRequest req, ConZoneManageCondition conZoneManageCondition) {
        if (ConZoneManageResUnsafeValid.audit(req, conZoneManageCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return conZoneManageResAtomic.audit_$ConZoneManageUpdateLock(req, conZoneManageCondition);
        }
    }

    public Mono<ServerResponse> auditReject(ServerRequest req, ConZoneManageCondition conZoneManageCondition) {
        if (ConZoneManageResUnsafeValid.auditReject(req, conZoneManageCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return conZoneManageResAtomic.auditReject_$ConZoneManageUpdateLock(req, conZoneManageCondition);
        }
    }

    public Mono<ServerResponse> usingEnable(ServerRequest req, ConZoneManageCondition conZoneManageCondition) {
        if (ConZoneManageResUnsafeValid.usingEnable(req, conZoneManageCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return conZoneManageResAtomic.usingEnable_$ConZoneManageUpdateLock(req, conZoneManageCondition);
        }
    }

    public Mono<ServerResponse> usingDisable(ServerRequest req, ConZoneManageCondition conZoneManageCondition) {
        if (ConZoneManageResUnsafeValid.usingDisable(req, conZoneManageCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return conZoneManageResAtomic.usingDisable_$ConZoneManageUpdateLock(req, conZoneManageCondition);
        }
    }

}
